package com.bolt.auth.admin.api.sys.entity;

import com.bolt.support.spring.jpa.entity.BaseNativeEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Created by Administrator on 2019/9/19.
 */
@Access(AccessType.FIELD)
@Entity
@Table(name = "oauth_client_details")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@DynamicInsert
@DynamicUpdate
@Data
public class ClientDetails extends BaseNativeEntity {

    /**
     * 应用标识
     */
    @Column(name="client_id")
    @ApiModelProperty(notes = "应用标识")
    private String clientId;

    @Column(name="client_name")
    @ApiModelProperty(notes = "应用名称")
    private String clientName;

    /**
     * 资源限定串(逗号分割)
     */
    @Column(name="resource_ids")
    @ApiModelProperty(notes = "资源限定串")
    private String resourceIds;
    /**
     * 应用密钥(bcyt) 加密
     */
    @Column(name="client_secret")
    @ApiModelProperty(notes = "应用密钥(bcyt) 加密")
    private String clientSecret;
    /**
     * 应用密钥(明文)
     */
    @Column(name="client_secret_str")
    @ApiModelProperty(notes = "应用密钥(明文)")
    private String clientSecretStr;
    /**
     * 范围
     */
    @Column(name="scope")
    @ApiModelProperty(notes = "范围")
    private String scope = "all";
    /**
     * 5种oauth授权方式(authorization_code,password,refresh_token,client_credentials)
     * authorization_code,password,refresh_token,client_credentials
     *

       简化模式
     */
    @ApiModelProperty(notes = " 5种oauth授权方式(授权码模式:authorization_code,密码模式:password,刷新令牌:refresh_token,客户端模式client_credentials 简化模式:implicit")
    @Column(name="authorized_grant_types")
    private String authorizedGrantTypes;
    /**
     * 回调地址
     */
    @Column(name="web_server_redirect_uri")
    @ApiModelProperty(notes = "回调地址")
    private String webServerRedirectUri;


    /**
     * access_token有效期
     */
    @Column(name="access_token_validity")
    @ApiModelProperty(notes = "access_token有效期")
    private Integer accessTokenValidity = 18000;

    /**
     * refresh_token有效期
     */
    @Column(name="refresh_token_validity")
    @ApiModelProperty(notes = "refresh_token有效期")
    private Integer refreshTokenValidity = 18000;

    @Column(name="additional_information")
    private String additionalInformation;

    /**
     * 是否自动授权 是-true
     */
    @Column(name="autoapprove")
    @ApiModelProperty(notes = "是否自动授权 是-true")
    private String autoapprove = "true";

    @Column(name="status")
    private Boolean status ;

}

 